

    //
//  SectionReusableView.m
//  掌上宏力
//
//  Created by admin on 17/3/2.
//  Copyright © 2017年 admin. All rights reserved.
//

#import "SectionReusableView.h"

@interface SectionReusableView ()
@property (nonatomic, weak) UILabel *label;


@end
@implementation SectionReusableView

- (instancetype)initWithFrame:(CGRect)frame {

    if (self = [super initWithFrame:frame]) {
    
        // label
        UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenW, 35)];
        view.backgroundColor = [UIColor whiteColor];
        [self addSubview:view];
        UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(5, 0, kScreenW, 35)];
        label.font = [UIFont systemFontOfSize:17];
        label.textColor = [UIColor blackColor];
        label.backgroundColor = [UIColor whiteColor];
        self.label = label;
        [view addSubview:self.label];
        
        //button
        UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
        button.frame = CGRectMake(0, 0, kScreenW, 35);
        [button addTarget:self action:@selector(clickedBlock:) forControlEvents:UIControlEventTouchUpInside];
        [view addSubview:button];
        
        }
    return self;
}
-(void)setTitle:(NSString *)title{
    self.label.textAlignment = NSTextAlignmentLeft;
    _title = title;
    self.label.text = title;
}
//点击事件
-(void)clickedBlock:(UIButton *)button{
    if (self.click) {
        self.click();
    }
}
-(void)clickedTitle:(clickEvent)click{
    self.click = click;
}

-(void)setGetLine:(BOOL)getLine{
    if (getLine == YES) {
        UIView *line = [Factory createViewWithBackgroundColor:Main_BGCOLOR frame:CGRectMake(0, 34, kScreenW, 1)];
        [self addSubview:line];
    }
}
@end
